//
//  MMNetworkRequest.h
//  EraPig
//
//  Created by Mac_Mini on 2021/3/8.
//

#import <Foundation/Foundation.h>
#import "NSObject+YYModel.h"
NS_ASSUME_NONNULL_BEGIN

@interface MMNetworkRequest : NSObject

+ (instancetype)sharedNetworkingManage;

/// GET数据请求
/// @param urlString URL
/// @param parameters 参数
/// @param success 成功回调
/// @param failure 失败回调
- (void)GET:(NSString *)urlString
 parameters:(nullable NSDictionary *)parameters
    success:(void (^) (id responseObject))success
    failure:(void (^) (NSError *error))failure;

/// POST数据请求
/// @param urlString URL
/// @param parameters 参数
/// @param success 成功回调
/// @param failure 失败回调
- (void)POST:(NSString *)urlString
  parameters:(nullable NSDictionary *)parameters
     success:(void (^) (id responseObject))success
     failure:(void (^) (NSError *error))failure;

/// PUT数据请求含
/// @param urlString URL
/// @param parameters 参数
/// @param success 成功回调
/// @param failure 失败回调
- (void)PUT:(NSString *)urlString
 parameters:(nullable NSDictionary *)parameters
    success:(void (^) (id responseObject))success
    failure:(void (^) (NSError *error))failure;


/// POST数据请求含Body
/// @param urlString URL
/// @param parameters 参数
/// @param body body
/// @param success 成功回调
/// @param failure 失败回调
- (void)POST:(NSString *)urlString
  parameters:(nullable NSDictionary *)parameters
        body:(nullable NSDictionary *)body
     success:(void (^) (id responseObject))success
     failure:(void (^) (NSError *error))failure;

/// PUT数据请求含Body
/// @param urlString URL
/// @param parameters 参数
/// @param body body
/// @param success 成功回调
/// @param failure 失败回调
- (void)PUT:(NSString *)urlString
 parameters:(nullable NSDictionary *)parameters
       body:(nullable NSDictionary *)body
    success:(void (^) (id responseObject))success
    failure:(void (^) (NSError *error))failure;

/// 上传文件（单个上传，文件data上传）
/// @param urlString URL
/// @param parameters 参数
/// @param fileData 文件data
/// @param fileName 文件名
/// @param name fileData对应的key
/// @param success 成功回调
/// @param failure 失败回调
- (void)UPLOAD:(NSString *)urlString
    parameters:(nullable NSDictionary *)parameters
      fileData:(NSData *)fileData
      fileName:(NSString *)fileName
          name:(NSString *)name
       success:(void (^) (id responseObject))success
       failure:(void (^) (NSError *error))failure;

/// 上传文件（多个上传，文件data上传）
/// @param urlString URL
/// @param parameters 参数
/// @param files 要上传的文件数组  @{@"data":NSURL/NSData, @"key":name, @"filename":filename}
/// @param success 成功回调
/// @param failure 失败回调
- (void)UPLOAD:(NSString *)urlString
    parameters:(nullable NSDictionary *)parameters
         files:(NSArray <NSDictionary *>*)files
       success:(void (^) (id responseObject))success
       failure:(void (^) (NSError *error))failure;

/// 下载文件、图片
/// @param urlString URL
/// @param progress 进度
/// @param success 成功
/// @param failure 失败
- (void)DOWNLOAD:(NSString *)urlString
        progress:(void (^) (double progress))progress
         success:(void (^) (id responseObject))success
         failure:(void (^) (NSError *error))failure;
@end

NS_ASSUME_NONNULL_END
